﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;
using Teigha.Core;

namespace Teigha.TD
{
	public class OdDbAnnotativeObjectPE : OdRxObject
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdDbAnnotativeObjectPE(IntPtr cPtr, bool cMemoryOwn) : base(TD_DbPINVOKE.OdDbAnnotativeObjectPE_SWIGUpcast(cPtr), cMemoryOwn)
		{
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdDbAnnotativeObjectPE obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdDbAnnotativeObjectPE()
		{
			this.Dispose();
		}

		public override void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							TD_DbPINVOKE.delete_OdDbAnnotativeObjectPE(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
			base.Dispose();
		}

		public new static OdDbAnnotativeObjectPE cast(OdRxObject pObj)
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = TD_DbPINVOKE.OdDbAnnotativeObjectPE_cast(OdRxObject.getCPtr(pObj));
			OdDbAnnotativeObjectPE result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdDbAnnotativeObjectPE)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdDbAnnotativeObjectPE)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdDbAnnotativeObjectPE)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new static OdRxClass desc()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(TD_DbPINVOKE.OdDbAnnotativeObjectPE_desc(), false);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxClass isA()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(TD_DbPINVOKE.OdDbAnnotativeObjectPE_isA(this.swigCPtr), false);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxObject queryX(OdRxClass protocolClass)
		{
			OdRxObject result = Teigha.Core.Helpers.odrxCreateObjectInternal(TD_DbPINVOKE.OdDbAnnotativeObjectPE_queryX(this.swigCPtr, OdRxClass.getCPtr(protocolClass)), false);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public static OdDbAnnotativeObjectPE createObject()
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = TD_DbPINVOKE.OdDbAnnotativeObjectPE_createObject();
			OdDbAnnotativeObjectPE result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdDbAnnotativeObjectPE)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdDbAnnotativeObjectPE)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdDbAnnotativeObjectPE)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual bool annotative(OdDbObject pObject)
		{
			bool result = TD_DbPINVOKE.OdDbAnnotativeObjectPE_annotative(this.swigCPtr, OdDbObject.getCPtr(pObject));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdResult setAnnotative(OdDbObject pObject, bool bAnnotative)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbAnnotativeObjectPE_setAnnotative(this.swigCPtr, OdDbObject.getCPtr(pObject), bAnnotative);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdResult setFromStyle(OdDbObject pObject, out bool bUpdated)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbAnnotativeObjectPE_setFromStyle(this.swigCPtr, OdDbObject.getCPtr(pObject), out bUpdated);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual bool forceAnnoAllVisible(OdDbObject arg0)
		{
			bool result = TD_DbPINVOKE.OdDbAnnotativeObjectPE_forceAnnoAllVisible(this.swigCPtr, OdDbObject.getCPtr(arg0));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdResult setForceAnnoAllVisible(OdDbObject arg0, bool arg1)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbAnnotativeObjectPE_setForceAnnoAllVisible(this.swigCPtr, OdDbObject.getCPtr(arg0), arg1);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdResult resetScaleDependentProperties(OdDbObject arg0)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbAnnotativeObjectPE_resetScaleDependentProperties(this.swigCPtr, OdDbObject.getCPtr(arg0));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		private object locker = new object();

		private HandleRef swigCPtr;
	}
}
